home *** CD-ROM | disk | FTP | other *** search
- <refentry id="libgimp-gimpmodule" revision="19 Jan 2001">
- <refmeta>
- <refentrytitle>gimpmodule</refentrytitle>
- <manvolnum>3</manvolnum>
- <refmiscinfo>LIBGIMP Library</refmiscinfo>
- </refmeta>
-
- <refnamediv>
- <refname>gimpmodule</refname><refpurpose>Common definitions for creating a pluggable GIMP module.</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv><title>Synopsis</title>
- <synopsis>
-
-
-
- enum <link linkend="GimpModuleStatus">GimpModuleStatus</link>;
- struct <link linkend="GimpModuleInfo">GimpModuleInfo</link>;
- <link linkend="GimpModuleStatus">GimpModuleStatus</link> (<link linkend="GimpModuleInitFunc">*GimpModuleInitFunc</link>) (<link linkend="GimpModuleInfo">GimpModuleInfo</link> **module_info);
- void (<link linkend="GimpModuleCompletedCB">*GimpModuleCompletedCB</link>) (<link linkend="gpointer">gpointer</link> completed_data);
- void (<link linkend="GimpModuleUnloadFunc">*GimpModuleUnloadFunc</link>) (<link linkend="gpointer">gpointer</link> shutdown_data,
- <link linkend="GimpModuleCompletedCB">GimpModuleCompletedCB</link> completed_cb,
- <link linkend="gpointer">gpointer</link> completed_data);
- </synopsis>
- </refsynopsisdiv>
-
-
-
-
-
- <refsect1>
- <title>Description</title>
- <para>
- Common definitions for creating a pluggable GIMP module.
-
- </para>
- </refsect1>
-
- <refsect1>
- <title>Details</title>
- <refsect2>
- <title><anchor id="GimpModuleStatus">enum GimpModuleStatus</title>
- <programlisting>typedef enum
- {
- GIMP_MODULE_OK,
- GIMP_MODULE_UNLOAD
- } GimpModuleStatus;
- </programlisting>
- <para>
-
- </para></refsect2>
- <refsect2>
- <title><anchor id="GimpModuleInfo">struct GimpModuleInfo</title>
- <programlisting>struct GimpModuleInfo
- {
- gpointer shutdown_data;
-
- const gchar *purpose;
- const gchar *author;
- const gchar *version;
- const gchar *copyright;
- const gchar *date;
- };
- </programlisting>
- <para>
-
- </para></refsect2>
- <refsect2>
- <title><anchor id="GimpModuleInitFunc">GimpModuleInitFunc ()</title>
- <programlisting><link linkend="GimpModuleStatus">GimpModuleStatus</link> (*GimpModuleInitFunc) (<link linkend="GimpModuleInfo">GimpModuleInfo</link> **module_info);</programlisting>
- <para>
- GIMP modules should <link linkend="G-MODULE-EXPORT-CAPS">G_MODULE_EXPORT</link> a function named "module_init"
- of this type.
- </para>
- <para>
- The "module_init" function is called by the GIMP at startup,
- and should return either <link linkend="GIMP-MODULE-OK-CAPS">GIMP_MODULE_OK</link> if it sucessfully initialised or
- <link linkend="GIMP-MODULE-UNLOAD-CAPS">GIMP_MODULE_UNLOAD</link> if the module failed to hook whatever functions
- it wanted. <link linkend="GIMP-MODULE-UNLOAD-CAPS">GIMP_MODULE_UNLOAD</link> causes the module to be closed, so
- the module must not have registered any internal functions or given
- out pointers to its data to anyone.
- </para>
- <para>
- If the module returns <link linkend="GIMP-MODULE-OK-CAPS">GIMP_MODULE_OK</link>, it should also return a
- <link linkend="GimpModuleInfo">GimpModuleInfo</link> structure describing itself.
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>module_info</parameter> :</entry>
- <entry>Returns the <link linkend="GimpModuleInfo">GimpModuleInfo</link> desribing the module.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>A <link linkend="GimpModuleStatus">GimpModuleStatus</link> value indicating success.
-
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="GimpModuleCompletedCB">GimpModuleCompletedCB ()</title>
- <programlisting>void (*GimpModuleCompletedCB) (<link linkend="gpointer">gpointer</link> completed_data);</programlisting>
- <para>
- The type of the <parameter>completed_cb</parameter> passed to the "module_unload" function
- (see below).
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>completed_data</parameter> :</entry>
- <entry><para>
- Must be the <parameter>completed_data</parameter> pointer provided by the "module_unload"
- function.
- </para>
-
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="GimpModuleUnloadFunc">GimpModuleUnloadFunc ()</title>
- <programlisting>void (*GimpModuleUnloadFunc) (<link linkend="gpointer">gpointer</link> shutdown_data,
- <link linkend="GimpModuleCompletedCB">GimpModuleCompletedCB</link> completed_cb,
- <link linkend="gpointer">gpointer</link> completed_data);</programlisting>
- <para>
- If GIMP modules want to allow themselves to be unloaded, they
- should <link linkend="G-MODULE-EXPORT-CAPS">G_MODULE_EXPORT</link> a function named "module_unload" of
- this type.
- </para>
- <para>
- GIMP calls the "module_unload" unload request function to ask
- a module to prepare itself to be unloaded. It is called with the
- value of <parameter>shutdown_data</parameter> supplied in the <link linkend="GimpModuleInfo">GimpModuleInfo</link> struct.
- The module should ensure that none of its code or data are being
- used, and then call the supplied <parameter>completed_cb</parameter> callback function with
- the <parameter>completed_data</parameter> provided. Typically the shutdown request function
- will queue de-registration activities then return. Only when the
- de-registration has finished should the <parameter>completed_cb</parameter> be invoked.
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>shutdown_data</parameter> :</entry>
- <entry>The <parameter>shutdown_data</parameter> supplied in the <link linkend="GimpModuleInfo">GimpModuleInfo</link> struct.
- </entry></row>
- <row><entry align="right"><parameter>completed_cb</parameter> :</entry>
- <entry>The function to call after successful unload.
- </entry></row>
- <row><entry align="right"><parameter>completed_data</parameter> :</entry>
- <entry>Has to be passed to the <parameter>completed_cb</parameter>.
-
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
-
- </refsect1>
-
-
-
- <refsect1>
- <title>See Also</title>
- <para>
- <link linkend="GModule">GModule</link>
- </para>
- </refsect1>
-
- </refentry>
-